package io.renren.service.impl;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;
import io.renren.dao.PriceBookDao;
import io.renren.entity.PriceBookEntity;
import io.renren.service.PriceBookService;

import java.util.Date;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;


@Service("priceBookService")
public class PriceBookServiceImpl extends ServiceImpl<PriceBookDao, PriceBookEntity> implements PriceBookService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        Page<PriceBookEntity> page = this.selectPage(
                new Query<PriceBookEntity>(params).getPage(),
                new EntityWrapper<PriceBookEntity>()
        );

        return new PageUtils(page);
    }

	@Override
	public Long totalVolume(Date startOfDay) {
		Long vol = baseMapper.totalVolume(startOfDay);
		return vol == null ? 0 : vol;
	}

}
